/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BeansGerenciaveis;

import DAO.DisciplinaDao;
import bean.DisciplinasGS;
import java.util.ArrayList;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

/**
 *
 * @author fernando
 */
@ManagedBean
@SessionScoped
public class DisciplinaConsulta {

    /**
     * Creates a new instance of DisciplinaConsulta
     */
    
    private DisciplinasGS disciplinaSelecionada;
    private ArrayList<DisciplinasGS> disciplinas;
    
    public DisciplinaConsulta() {
        this.disciplinaSelecionada = new DisciplinasGS();
    }

    public DisciplinasGS getDisciplinaSelecionada() {
        this.disciplinaSelecionada = new DisciplinaDao().buscar(this.disciplinaSelecionada.getId());
        return disciplinaSelecionada;
    }

    public void setDisciplinaSelecionada(DisciplinasGS disciplinaSelecionada) {
        this.disciplinaSelecionada = disciplinaSelecionada;
    }

    public ArrayList<DisciplinasGS> getDisciplinas() {
        if(this.disciplinas == null){
            this.disciplinas = new DisciplinaDao().listar();
        }
        return disciplinas;
    }

    public void setDisciplinas(ArrayList<DisciplinasGS> disciplinas) {
        this.disciplinas = disciplinas;
    }
    
    
    
    
    
    
}
